package com.rongke.web;

import com.rongke.commons.JsonResp;
import com.rongke.mapper.SysSuggestMapper;
import com.rongke.model.SysSuggest;
import com.rongke.service.SysSuggestService;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigInteger;
import java.util.List;

/**
 * @SysSuggestController
 * @系统建议Controller
 * @version : Ver 1.0
 */
@RestController
@RequestMapping(value="/api/sysSuggest")
@Transactional
public class SysSuggestController {
    private Logger log = Logger.getLogger(this.getClass());
    @Autowired
    private SysSuggestService sysSuggestService;

    /**
     * @添加系统建议
     * @param sysSuggest
     * @return 返回值JsonResp
     */
    @RequestMapping(value="/add", method = RequestMethod.POST)
    public JsonResp addSysSuggest(@RequestBody SysSuggest sysSuggest){
        log.debug("添加系统建议");
        sysSuggestService.insert(sysSuggest);
        return JsonResp.ok(sysSuggest);
    }

    /**
     * @修改系统建议
     * @param sysSuggest
     * @return 返回值JsonResp
     */
    @RequestMapping(value="/update", method = RequestMethod.POST)
    public JsonResp updateSysSuggest(@RequestBody SysSuggest sysSuggest){
        log.debug("修改系统建议");
        sysSuggestService.updateById(sysSuggest);
        return JsonResp.ok(sysSuggest);
    }
    /**
     * @根据id查找系统建议
     * @param id
     * @return 返回值JsonResp
     */
    @RequestMapping(value="/selectOne", method = RequestMethod.GET)
    public JsonResp selectSysSuggest(Long id){
        log.debug("查找系统建议");
        SysSuggest sysSuggest = sysSuggestService.selectById(id);
        return JsonResp.ok(sysSuggest);
    }


}
